package org.jeecg.common.system.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 全部 Entity
 *
 * @author chechen
 * @date 2022-02-14
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class AllEntity extends GenericEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableField(update = "%s+1")
    @ApiModelProperty(value = "版本号", hidden = true)
    protected Integer lockVersion;

    @TableLogic
    @TableField(select = false)
    @ApiModelProperty(value = "是否删除", hidden = true)
    protected Integer delFlag;

    /**
     * 清除数据
     */
    @Override
    public void clearFields () {
        super.clearFields();
        this.lockVersion = 1;
        this.delFlag = null;
    }
}
